#include "InOutShader.h"

InOutShader::InOutShader()
{
    this->vertexShaderSource =
        "#version 330 core\n"
        "layout (location = 0) in vec3 aPos;\n"
        "out vec4 vertexColor;\n"   // 顶点着色器中声明输出颜色
        "void main()\n"
        "{\n"
        // gl_Position 作为顶点着色器的数据，要求是一个四维向量，并且是符合
        // Normalized Device Coordinates (NDC) 类型
        // 因为这个demo的输入就是符合Normalized Device Coordinates
        // (NDC)，所以这里直接转换为四维向量即可
        "   gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
        "   vertexColor = vec4(0.5, 0, 0.2, 1.0);\n"
        "}\0";

    this->fragmentShaderSource =
        "#version 330 core\n"
        "out vec4 FragColor;\n"
        "in  vec4 vertexColor;\n"   //  片段着色器中声明接受顶点着色器中输出的顶点颜色
        "void main()\n"
        "{\n"
        "FragColor = vertexColor;\n"
        "}\0";
}